/**
 * Copyright 2025 Adobe. All rights reserved.
 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License. You may obtain a copy
 * of the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
 * OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */

:host {
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    box-sizing: border-box;
    font-family: var(--mod-button-font-family, var(--mod-sans-font-family-stack, var(--spectrum-sans-font-family-stack)));
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: var(--mod-button-line-height, var(--mod-line-height-100, var(--spectrum-line-height-100)));
    text-transform: none;
    vertical-align: top;
    -webkit-appearance: button;
    transition:
        background var(--mod-button-animation-duration, var(--mod-animation-duration-100, var(--spectrum-animation-duration-100))) ease-out,
        border-color var(--mod-button-animation-duration, var(--mod-animation-duration-100, var(--spectrum-animation-duration-100))) ease-out,
        color var(--mod-button-animation-duration, var(--mod-animation-duration-100, var(--spectrum-animation-duration-100))) ease-out,
        box-shadow var(--mod-button-animation-duration, var(--mod-animation-duration-100, var(--spectrum-animation-duration-100))) ease-out;
    justify-content: center;
    align-items: center;
    margin: 0;
    -webkit-text-decoration: none;
    text-decoration: none;
    display: inline-flex;
    overflow: visible;
}

:host(:focus) {
    outline: none;
}

:host .is-disabled,
:host([disabled]) {
    cursor: default;
}

:host:after {
    margin: calc(var(--mod-button-focus-indicator-gap, var(--spectrum-focus-indicator-gap)) * -1);
    transition:
        opacity var(--mod-button-animation-duration, var(--mod-button-animation-duration, var(--spectrum-animation-duration-100))) ease-out,
        margin var(--mod-button-animation-duration, var(--mod-button-animation-duration, var(--spectrum-animation-duration-100))) ease-out;
    display: block;
    inset-block: 0;
    inset-inline: 0;
}

:host(:focus-visible):after {
    margin: calc(var(--mod-focus-indicator-gap, var(--spectrum-focus-indicator-gap)) * -2);
}

#label {
    text-align: center;
    place-self: center;
}

#label[hidden] {
    display: none;
}

:host {
    --spectrum-button-sized-height: var(--spectrum-component-height-100);
    --spectrum-button-sized-font-size: var(--spectrum-font-size-100);
    --spectrum-button-sized-edge-to-visual: calc(var(--spectrum-component-pill-edge-to-visual-100) - var(--spectrum-button-border-width));
    --spectrum-button-sized-edge-to-visual-only: var(--spectrum-component-pill-edge-to-visual-only-100);
    --spectrum-button-sized-edge-to-text: calc(var(--spectrum-component-pill-edge-to-text-100) - var(--spectrum-button-border-width));
    --spectrum-button-sized-padding-label-to-icon: var(--spectrum-text-to-visual-100);
    --spectrum-button-sized-top-to-text: var(--spectrum-button-top-to-text-medium);
    --spectrum-button-sized-bottom-to-text: var(--spectrum-button-bottom-to-text-medium);
    --spectrum-button-sized-top-to-icon: var(--spectrum-component-top-to-workflow-icon-100);
    --spectrum-button-intended-icon-size: var(--spectrum-workflow-icon-size-100);
}

:host([size="s"]) {
    --spectrum-button-sized-height: var(--spectrum-component-height-75);
    --spectrum-button-sized-font-size: var(--spectrum-font-size-75);
    --spectrum-button-sized-edge-to-visual: calc(var(--spectrum-component-pill-edge-to-visual-75) - var(--spectrum-button-border-width));
    --spectrum-button-sized-edge-to-visual-only: var(--spectrum-component-pill-edge-to-visual-only-75);
    --spectrum-button-sized-edge-to-text: calc(var(--spectrum-component-pill-edge-to-text-75) - var(--spectrum-button-border-width));
    --spectrum-button-sized-padding-label-to-icon: var(--spectrum-text-to-visual-75);
    --spectrum-button-sized-top-to-text: var(--spectrum-button-top-to-text-small);
    --spectrum-button-sized-bottom-to-text: var(--spectrum-button-bottom-to-text-small);
    --spectrum-button-sized-top-to-icon: var(--spectrum-component-top-to-workflow-icon-75);
    --spectrum-button-intended-icon-size: var(--spectrum-workflow-icon-size-75);
}

:host([size="l"]) {
    --spectrum-button-sized-height: var(--spectrum-component-height-200);
    --spectrum-button-sized-font-size: var(--spectrum-font-size-200);
    --spectrum-button-sized-edge-to-visual: calc(var(--spectrum-component-pill-edge-to-visual-200) - var(--spectrum-button-border-width));
    --spectrum-button-sized-edge-to-visual-only: var(--spectrum-component-pill-edge-to-visual-only-200);
    --spectrum-button-sized-edge-to-text: calc(var(--spectrum-component-pill-edge-to-text-200) - var(--spectrum-button-border-width));
    --spectrum-button-sized-padding-label-to-icon: var(--spectrum-text-to-visual-200);
    --spectrum-button-sized-top-to-text: var(--spectrum-button-top-to-text-large);
    --spectrum-button-sized-bottom-to-text: var(--spectrum-button-bottom-to-text-large);
    --spectrum-button-sized-top-to-icon: var(--spectrum-component-top-to-workflow-icon-200);
    --spectrum-button-intended-icon-size: var(--spectrum-workflow-icon-size-200);
}

:host([size="xl"]) {
    --spectrum-button-sized-height: var(--spectrum-component-height-300);
    --spectrum-button-sized-font-size: var(--spectrum-font-size-300);
    --spectrum-button-sized-edge-to-visual: calc(var(--spectrum-component-pill-edge-to-visual-300) - var(--spectrum-button-border-width));
    --spectrum-button-sized-edge-to-visual-only: var(--spectrum-component-pill-edge-to-visual-only-300);
    --spectrum-button-sized-edge-to-text: calc(var(--spectrum-component-pill-edge-to-text-300) - var(--spectrum-button-border-width));
    --spectrum-button-sized-padding-label-to-icon: var(--spectrum-text-to-visual-300);
    --spectrum-button-sized-top-to-text: var(--spectrum-button-top-to-text-extra-large);
    --spectrum-button-sized-bottom-to-text: var(--spectrum-button-bottom-to-text-extra-large);
    --spectrum-button-sized-top-to-icon: var(--spectrum-component-top-to-workflow-icon-300);
    --spectrum-button-intended-icon-size: var(--spectrum-workflow-icon-size-300);
}

:host {
    --spectrum-button-content-color-default: var(--spectrum-neutral-content-color-default);
    --spectrum-button-content-color-hover: var(--spectrum-neutral-content-color-hover);
    --spectrum-button-content-color-down: var(--spectrum-neutral-content-color-down);
    --spectrum-button-content-color-focus: var(--spectrum-neutral-content-color-key-focus);
    --spectrum-button-content-color-disabled: var(--spectrum-disabled-content-color);
}

:host([selected]) {
    --spectrum-button-border-color-default: transparent;
    --spectrum-button-border-color-hover: transparent;
    --spectrum-button-border-color-down: transparent;
    --spectrum-button-border-color-focus: transparent;
    --spectrum-button-content-color-default: var(--spectrum-white);
    --spectrum-button-content-color-hover: var(--spectrum-white);
    --spectrum-button-content-color-down: var(--spectrum-white);
    --spectrum-button-content-color-focus: var(--spectrum-white);
    --spectrum-button-background-color-disabled: var(--spectrum-disabled-background-color);
    --spectrum-button-border-color-disabled: transparent;
}

:host([selected][emphasized]),
:host([variant="accent"]) {
    --spectrum-button-background-color-default: var(--spectrum-accent-background-color-default);
    --spectrum-button-background-color-hover: var(--spectrum-accent-background-color-hover);
    --spectrum-button-background-color-down: var(--spectrum-accent-background-color-down);
    --spectrum-button-background-color-focus: var(--spectrum-accent-background-color-key-focus);
}

:host([variant="accent"]) {
    --spectrum-button-background-color-disabled: var(--spectrum-disabled-background-color);
    --spectrum-button-border-color-default: transparent;
    --spectrum-button-border-color-hover: transparent;
    --spectrum-button-border-color-down: transparent;
    --spectrum-button-border-color-focus: transparent;
    --spectrum-button-border-color-disabled: transparent;
    --spectrum-button-content-color-default: var(--spectrum-white);
    --spectrum-button-content-color-hover: var(--spectrum-white);
    --spectrum-button-content-color-down: var(--spectrum-white);
    --spectrum-button-content-color-focus: var(--spectrum-white);
}

:host([variant="accent"][treatment="outline"]) {
    --spectrum-button-background-color-hover: var(--spectrum-accent-color-200);
    --spectrum-button-background-color-down: var(--spectrum-accent-color-300);
    --spectrum-button-background-color-focus: var(--spectrum-accent-color-200);
    --spectrum-button-border-color-default: var(--spectrum-accent-color-900);
    --spectrum-button-border-color-hover: var(--spectrum-accent-color-1000);
    --spectrum-button-border-color-down: var(--spectrum-accent-color-1100);
    --spectrum-button-border-color-focus: var(--spectrum-accent-color-1000);
    --spectrum-button-border-color-disabled: var(--spectrum-disabled-border-color);
    --spectrum-button-content-color-default: var(--spectrum-accent-content-color-default);
    --spectrum-button-content-color-hover: var(--spectrum-accent-content-color-hover);
    --spectrum-button-content-color-down: var(--spectrum-accent-content-color-down);
    --spectrum-button-content-color-focus: var(--spectrum-accent-content-color-key-focus);
    --spectrum-button-content-color-disabled: var(--spectrum-disabled-content-color);
}

:host([variant="negative"]) {
    --spectrum-button-background-color-default: var(--spectrum-negative-background-color-default);
    --spectrum-button-background-color-hover: var(--spectrum-negative-background-color-hover);
    --spectrum-button-background-color-down: var(--spectrum-negative-background-color-down);
    --spectrum-button-background-color-focus: var(--spectrum-negative-background-color-key-focus);
    --spectrum-button-border-color-default: transparent;
    --spectrum-button-border-color-hover: transparent;
    --spectrum-button-border-color-down: transparent;
    --spectrum-button-border-color-focus: transparent;
    --spectrum-button-content-color-default: var(--spectrum-white);
    --spectrum-button-content-color-hover: var(--spectrum-white);
    --spectrum-button-content-color-down: var(--spectrum-white);
    --spectrum-button-content-color-focus: var(--spectrum-white);
    --spectrum-button-background-color-disabled: var(--spectrum-disabled-background-color);
    --spectrum-button-border-color-disabled: transparent;
    --spectrum-button-content-color-disabled: var(--spectrum-disabled-content-color);
}

:host([variant="negative"][treatment="outline"]) {
    --spectrum-button-background-color-hover: var(--spectrum-negative-color-200);
    --spectrum-button-background-color-down: var(--spectrum-negative-color-300);
    --spectrum-button-background-color-focus: var(--spectrum-negative-color-200);
    --spectrum-button-border-color-default: var(--spectrum-negative-color-900);
    --spectrum-button-border-color-hover: var(--spectrum-negative-color-1000);
    --spectrum-button-border-color-down: var(--spectrum-negative-color-1100);
    --spectrum-button-border-color-focus: var(--spectrum-negative-color-1000);
    --spectrum-button-border-color-disabled: var(--spectrum-disabled-border-color);
    --spectrum-button-content-color-default: var(--spectrum-negative-content-color-default);
    --spectrum-button-content-color-hover: var(--spectrum-negative-content-color-hover);
    --spectrum-button-content-color-down: var(--spectrum-negative-content-color-down);
    --spectrum-button-content-color-focus: var(--spectrum-negative-content-color-key-focus);
    --spectrum-button-content-color-disabled: var(--spectrum-disabled-content-color);
}

:host([variant="primary"]) {
    --spectrum-button-background-color-default: var(--spectrum-neutral-background-color-default);
    --spectrum-button-background-color-hover: var(--spectrum-neutral-background-color-hover);
    --spectrum-button-background-color-down: var(--spectrum-neutral-background-color-down);
    --spectrum-button-background-color-focus: var(--spectrum-neutral-background-color-key-focus);
    --spectrum-button-background-color-disabled: var(--spectrum-disabled-background-color);
    --spectrum-button-border-color-default: transparent;
    --spectrum-button-border-color-hover: transparent;
    --spectrum-button-border-color-down: transparent;
    --spectrum-button-border-color-focus: transparent;
    --spectrum-button-border-color-disabled: transparent;
}

:host([variant="primary"][treatment="outline"]) {
    --spectrum-button-border-color-default: var(--spectrum-gray-800);
    --spectrum-button-border-color-hover: var(--spectrum-gray-900);
    --spectrum-button-border-color-down: var(--spectrum-gray-900);
    --spectrum-button-border-color-focus: var(--spectrum-gray-900);
    --spectrum-button-content-color-default: var(--spectrum-neutral-content-color-default);
    --spectrum-button-content-color-hover: var(--spectrum-neutral-content-color-hover);
    --spectrum-button-content-color-down: var(--spectrum-neutral-content-color-down);
    --spectrum-button-content-color-focus: var(--spectrum-neutral-content-color-key-focus);
    --spectrum-button-border-color-disabled: var(--spectrum-disabled-border-color);
    --spectrum-button-content-color-disabled: var(--spectrum-disabled-content-color);
}

:host([variant="secondary"]) {
    --spectrum-button-background-color-disabled: var(--spectrum-disabled-background-color);
    --spectrum-button-border-color-default: transparent;
    --spectrum-button-border-color-hover: transparent;
    --spectrum-button-border-color-down: transparent;
    --spectrum-button-border-color-focus: transparent;
    --spectrum-button-border-color-disabled: transparent;
    --spectrum-button-content-color-default: var(--spectrum-neutral-content-color-default);
    --spectrum-button-content-color-hover: var(--spectrum-neutral-content-color-hover);
    --spectrum-button-content-color-down: var(--spectrum-neutral-content-color-down);
    --spectrum-button-content-color-focus: var(--spectrum-neutral-content-color-key-focus);
    --spectrum-button-content-color-disabled: var(--spectrum-disabled-content-color);
}

:host([variant="secondary"][treatment="outline"]) {
    --spectrum-button-background-color-down: var(--spectrum-gray-400);
    --spectrum-button-border-color-default: var(--spectrum-gray-300);
    --spectrum-button-border-color-hover: var(--spectrum-gray-400);
    --spectrum-button-border-color-focus: var(--spectrum-gray-400);
    --spectrum-button-border-color-disabled: var(--spectrum-disabled-border-color);
    --spectrum-button-content-color-default: var(--spectrum-neutral-content-color-default);
    --spectrum-button-content-color-hover: var(--spectrum-neutral-content-color-hover);
    --spectrum-button-content-color-down: var(--spectrum-neutral-content-color-down);
    --spectrum-button-content-color-focus: var(--spectrum-neutral-content-color-key-focus);
    --spectrum-button-content-color-disabled: var(--spectrum-disabled-content-color);
}

:host([quiet]) {
    --spectrum-button-background-color-hover: var(--spectrum-gray-200);
    --spectrum-button-background-color-down: var(--spectrum-gray-300);
    --spectrum-button-background-color-focus: var(--spectrum-gray-200);
}

:host([quiet]),
:host([static-color="black"]),
:host([static-color="white"]) {
    --spectrum-button-border-color-default: transparent;
    --spectrum-button-border-color-hover: transparent;
    --spectrum-button-border-color-down: transparent;
    --spectrum-button-border-color-focus: transparent;
    --spectrum-button-border-color-disabled: transparent;
}

:host([static-color="black"][selected]),
:host([static-color="white"][selected]) {
    --mod-button-content-color-default: var(--mod-button-static-content-color);
    --mod-button-content-color-hover: var(--mod-button-static-content-color);
    --mod-button-content-color-down: var(--mod-button-static-content-color);
    --mod-button-content-color-focus: var(--mod-button-static-content-color);
    --spectrum-button-border-color-disabled: transparent;
}

:host([static-color="black"][variant="secondary"]),
:host([static-color="white"][variant="secondary"]) {
    --spectrum-button-border-color-default: transparent;
    --spectrum-button-border-color-hover: transparent;
    --spectrum-button-border-color-down: transparent;
    --spectrum-button-border-color-focus: transparent;
    --spectrum-button-border-color-disabled: transparent;
}

:host([static-color="black"][variant="secondary"][treatment="outline"]),
:host([static-color="white"][variant="secondary"][treatment="outline"]) {
    --spectrum-button-background-color-disabled: transparent;
}

:host([static-color="black"][quiet]),
:host([static-color="white"][quiet]) {
    --spectrum-button-border-color-default: transparent;
    --spectrum-button-border-color-hover: transparent;
    --spectrum-button-border-color-down: transparent;
    --spectrum-button-border-color-focus: transparent;
    --spectrum-button-border-color-disabled: transparent;
}

:host([static-color="white"]) {
    --spectrum-button-content-color-disabled: var(--spectrum-disabled-static-white-content-color);
    --spectrum-button-background-color-disabled: var(--spectrum-disabled-static-white-background-color);
    --spectrum-button-focus-indicator-color: var(--spectrum-static-white-focus-indicator-color);
}

:host([static-color="white"][treatment="outline"]) {
    --spectrum-button-content-color-disabled: var(--spectrum-disabled-static-white-content-color);
    --spectrum-button-border-color-disabled: var(--spectrum-disabled-static-white-border-color);
}

:host([static-color="white"][variant="secondary"]) {
    --spectrum-button-background-color-disabled: var(--spectrum-disabled-static-white-background-color);
}

:host([static-color="black"]) {
    --spectrum-button-content-color-disabled: var(--spectrum-disabled-static-black-content-color);
    --spectrum-button-background-color-disabled: var(--spectrum-disabled-static-black-background-color);
    --spectrum-button-focus-indicator-color: var(--mod-static-black-focus-indicator-color, var(--spectrum-static-black-focus-indicator-color));
}

:host([static-color="black"][treatment="outline"]) {
    --spectrum-button-content-color-disabled: var(--spectrum-disabled-static-black-content-color);
    --spectrum-button-border-color-disabled: var(--spectrum-disabled-static-black-border-color);
}

:host([static-color="black"][variant="secondary"]) {
    --spectrum-button-background-color-disabled: var(--spectrum-disabled-static-black-background-color);
}

:host([treatment="outline"]),
:host([quiet]) {
    --spectrum-button-background-color-default: transparent;
    --spectrum-button-background-color-disabled: transparent;
}

:host {
    --spectrum-button-height: var(--mod-button-height, var(--spectrum-button-sized-height));
    --spectrum-button-min-width: var(--mod-button-min-width, calc(var(--spectrum-button-height) * var(--spectrum-button-minimum-width-multiplier)));
    --spectrum-button-line-height: var(--mod-button-line-height, 1.2);
    --spectrum-button-font-size: var(--mod-button-font-size, var(--spectrum-button-sized-font-size));
    --spectrum-button-padding-label-to-icon: var(--mod-button-padding-label-to-icon, var(--spectrum-button-sized-padding-label-to-icon));
    --spectrum-button-edge-to-visual: var(--mod-button-edge-to-visual, var(--spectrum-button-sized-edge-to-visual));
    --spectrum-button-edge-to-visual-only: var(--mod-button-edge-to-visual-only, var(--spectrum-button-sized-edge-to-visual-only));
    --spectrum-button-edge-to-text: var(--mod-button-edge-to-text, var(--spectrum-button-sized-edge-to-text));
    --spectrum-button-top-to-text: var(--mod-button-top-to-text, var(--spectrum-button-sized-top-to-text));
    --spectrum-button-bottom-to-text: var(--mod-button-bottom-to-text, var(--spectrum-button-sized-bottom-to-text));
    --spectrum-button-top-to-icon: var(--mod-button-top-to-icon, var(--spectrum-button-sized-top-to-icon));
    --spectrum-button-focus-ring-thickness: var(--mod-button-focus-ring-thickness, var(--spectrum-focus-indicator-thickness));
    --spectrum-button-focus-indicator-color: var(--mod-button-focus-ring-color, var(--spectrum-focus-indicator-color));
    --spectrum-button-animation-duration: var(--mod-button-animation-duration, var(--spectrum-animation-duration-100));
    --spectrum-button-border-width: var(--mod-button-border-width, var(--spectrum-border-width-200));
    --spectrum-button-focus-ring-gap: var(--mod-focus-indicator-gap, var(--mod-button-focus-ring-gap, var(--spectrum-focus-indicator-gap)));
    --spectrum-button-border-radius: var(--mod-button-border-radius, calc(var(--spectrum-button-height) / 2));
    --mod-progress-circle-position: absolute;
    border-radius: var(--spectrum-button-border-radius);
    border-width: var(--spectrum-button-border-width);
    font-size: var(--spectrum-button-font-size);
    font-weight: var(--mod-bold-font-weight, var(--spectrum-bold-font-weight));
    gap: var(--spectrum-button-padding-label-to-icon);
    max-inline-size: var(--mod-button-max-inline-size, none);
    min-inline-size: var(--spectrum-button-min-width);
    min-block-size: var(--spectrum-button-height);
    padding-block: 0;
    padding-inline: var(--spectrum-button-edge-to-text);
    margin-block: var(--mod-button-margin-block);
    background-color: var(--highcontrast-button-background-color-default, var(--mod-button-background-color-default, var(--spectrum-button-background-color-default)));
    border-style: solid;
    border-color: var(--highcontrast-button-border-color-default, var(--mod-button-border-color-default, var(--spectrum-button-border-color-default)));
    color: var(--highcontrast-button-content-color-default, var(--mod-button-content-color-default, var(--spectrum-button-content-color-default, inherit)));
    transition:
        border var(--spectrum-button-animation-duration, 0.13s) linear,
        color var(--spectrum-button-animation-duration, 0.13s) linear,
        background-color var(--spectrum-button-animation-duration, 0.13s) linear;
    margin-inline-start: var(--mod-button-margin-left);
    margin-inline-end: var(--mod-button-margin-right);
    position: relative;
}

:host([treatment="outline"]) {
    background-color: initial;
}

:host:after {
    margin: var(--mod-button-focus-ring-border-radius, calc((var(--spectrum-button-focus-ring-gap) + var(--spectrum-button-border-width)) * -1));
    transition: box-shadow var(--spectrum-button-animation-duration) ease-in-out;
    pointer-events: none;
    content: "";
    border-radius: calc(var(--spectrum-button-border-radius) + var(--spectrum-focus-indicator-gap));
    position: absolute;
    inset: 0;
}

:host(:focus-visible) {
    background-color: var(--highcontrast-button-background-color-focus, var(--mod-button-background-color-focus, var(--spectrum-button-background-color-focus)));
    border-color: var(--highcontrast-button-border-color-focus, var(--mod-button-border-color-focus, var(--spectrum-button-border-color-focus)));
    color: var(--highcontrast-button-content-color-focus, var(--mod-button-content-color-focus, var(--spectrum-button-content-color-focus)));
    box-shadow: none;
    outline: none;
}

:host([focused]):after,
:host(:focus-visible):after {
    box-shadow: 0 0 0 var(--spectrum-button-focus-ring-thickness) var(--spectrum-button-focus-indicator-color);
}

:host(:is(:active, [active])) {
    background-color: var(--highcontrast-button-background-color-down, var(--mod-button-background-color-down, var(--spectrum-button-background-color-down)));
    border-color: var(--highcontrast-button-border-color-down, var(--mod-button-border-color-down, var(--spectrum-button-border-color-down)));
    color: var(--highcontrast-button-content-color-down, var(--mod-button-content-color-down, var(--spectrum-button-content-color-down)));
    box-shadow: none;
}

@media (hover: hover) {
    :host(:hover) {
        background-color: var(--highcontrast-button-background-color-hover, var(--mod-button-background-color-hover, var(--spectrum-button-background-color-hover)));
        border-color: var(--highcontrast-button-border-color-hover, var(--mod-button-border-color-hover, var(--spectrum-button-border-color-hover)));
        color: var(--highcontrast-button-content-color-hover, var(--mod-button-content-color-hover, var(--spectrum-button-content-color-hover)));
        box-shadow: none;
    }
}

:host .is-disabled,
:host([pending]),
:host([disabled]),
:host([pending]) {
    background-color: var(--highcontrast-button-background-color-disabled, var(--mod-button-background-color-disabled, var(--spectrum-button-background-color-disabled)));
    border-color: var(--highcontrast-button-border-color-disabled, var(--mod-button-border-color-disabled, var(--spectrum-button-border-color-disabled)));
    color: var(--highcontrast-button-content-color-disabled, var(--mod-button-content-color-disabled, var(--spectrum-button-content-color-disabled)));
}

::slotted([slot="icon"]) {
    --_icon-size-difference: max(0px, var(--spectrum-button-intended-icon-size) - var(--spectrum-icon-block-size, var(--spectrum-button-intended-icon-size)));
    margin-block-start: var(--mod-button-icon-margin-block-start, max(0px, var(--mod-button-top-to-icon, var(--spectrum-button-top-to-icon)) - var(--mod-button-border-width, var(--spectrum-button-border-width)) + (var(--_icon-size-difference, 0px) / 2)));
    margin-inline-start: calc(var(--mod-button-edge-to-visual, var(--spectrum-button-edge-to-visual)) - var(--mod-button-edge-to-text, var(--spectrum-button-edge-to-text)));
}

:host([icon-only]) {
    padding: calc(var(--mod-button-edge-to-visual-only, var(--spectrum-button-edge-to-visual-only)) - var(--mod-button-border-width, var(--spectrum-button-border-width)));
}

#label,
::slotted([slot="icon"]) {
    visibility: visible;
    opacity: 1;
    transition: opacity var(--spectrum-button-animation-duration, 0.13s) ease-in-out;
}

.spectrum-ProgressCircle {
    visibility: hidden;
    opacity: 0;
    transition:
        opacity var(--spectrum-button-animation-duration, 0.13s) ease-in-out,
        visibility 0s linear var(--spectrum-button-animation-duration, 0.13s);
}

:host([pending]),
:host([pending]) {
    cursor: default;
}

:host([pending]) .spectrum-ProgressCircle,
:host([pending]) .spectrum-ProgressCircle {
    visibility: visible;
    opacity: 1;
    transition: opacity var(--spectrum-button-animation-duration, 0.13s) ease-in-out;
}

::slotted([slot="icon"]) {
    --_icon-size-difference: max(0px, calc(var(--spectrum-button-intended-icon-size) - var(--spectrum-icon-block-size, var(--spectrum-button-intended-icon-size))));
    color: inherit;
    flex-shrink: 0;
    align-self: flex-start;
    margin-block-start: var(--mod-button-icon-margin-block-start, max(0px, calc(var(--spectrum-button-top-to-icon) - var(--spectrum-button-border-width) + var(--_icon-size-difference, 0px) / 2)));
    margin-inline-start: calc(var(--spectrum-button-edge-to-visual) - var(--spectrum-button-edge-to-text));
}

:host([icon-only]) {
    min-inline-size: unset;
    padding: calc(var(--spectrum-button-edge-to-visual-only) - var(--spectrum-button-border-width));
    border-radius: 50%;
}

:host([icon-only]) ::slotted([slot="icon"]) {
    align-self: center;
    margin-block-start: 0;
    margin-inline-start: 0;
}

:host([icon-only]):after {
    border-radius: 50%;
}

[name="icon"] + #label {
    text-align: var(--mod-button-text-align-with-icon, start);
}

#label {
    line-height: var(--spectrum-button-line-height);
    text-align: var(--mod-button-text-align, center);
    align-self: start;
    padding-block-start: calc(var(--spectrum-button-top-to-text) - var(--spectrum-button-border-width));
    padding-block-end: calc(var(--spectrum-button-bottom-to-text) - var(--spectrum-button-border-width));
}

:host([no-wrap]) #label {
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

@media (forced-colors: active) {
    :host {
        --highcontrast-button-content-color-default: ButtonText;
        --highcontrast-button-content-color-hover: ButtonText;
        --highcontrast-button-content-color-focus: ButtonText;
        --highcontrast-button-content-color-down: ButtonText;
        --highcontrast-button-content-color-disabled: GrayText;
        --highcontrast-button-border-color-default: ButtonBorder;
        --highcontrast-button-border-color-hover: ButtonBorder;
        --highcontrast-button-border-color-focus: ButtonBorder;
        --highcontrast-button-border-color-down: ButtonBorder;
        --highcontrast-button-border-color-disabled: GrayText;
        --highcontrast-button-background-color-default: ButtonFace;
        --highcontrast-button-background-color-hover: ButtonFace;
        --highcontrast-button-background-color-down: ButtonFace;
        --highcontrast-button-background-color-focus: ButtonFace;
        --highcontrast-button-background-color-disabled: ButtonFace;
        --mod-progress-circle-track-border-color: ButtonText;
        --mod-progress-circle-track-border-color-over-background: ButtonText;
        --mod-progress-circle-thickness: var(--spectrum-progress-circle-thickness-medium);
        --spectrum-button-animation-duration: 0s;
    }

    #label {
        forced-color-adjust: none;
    }

    :host(:focus-visible):after {
        forced-color-adjust: none;
        box-shadow: 0 0 0 var(--spectrum-button-focus-ring-thickness) ButtonText;
    }

    :host([variant="accent"][treatment="fill"]) {
        --highcontrast-button-background-color-default: ButtonText;
        --highcontrast-button-background-color-hover: Highlight;
        --highcontrast-button-background-color-down: Highlight;
        --highcontrast-button-background-color-focus: Highlight;
        --highcontrast-button-background-color-disabled: ButtonFace;
        --highcontrast-button-content-color-default: ButtonFace;
        --highcontrast-button-content-color-hover: HighlightText;
        --highcontrast-button-content-color-down: HighlightText;
        --highcontrast-button-content-color-focus: HighlightText;
        --highcontrast-button-border-color-default: ButtonText;
        --highcontrast-button-border-color-hover: Highlight;
        --highcontrast-button-border-color-focus: Highlight;
        --highcontrast-button-border-color-down: Highlight;
    }

    :host([static-color="white"][variant="accent"]) {
        --highcontrast-button-content-color-disabled: GrayText;
    }
}
